/**
 * 
 */
package com.td.framework.webmanager.common;

import org.apache.struts2.ServletActionContext;

import com.td.framework.common.Constant;
import com.td.framework.webmanager.login.UserInfo;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 
 * Title: Description: 
 * Copyright: Copyright (c) 2008 
 * Company 北京水软科技有限公司
 * 
 * @author FLT006
 * @version 1.0
 */
public class LoginInterceptor extends AbstractInterceptor {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public String intercept(ActionInvocation arg0) throws Exception {
		
		String uri = ServletActionContext.getRequest().getServletPath();
		UserInfo userInfo = (UserInfo)ServletActionContext.getRequest().getSession().getAttribute("userInfo");
		if(!Constant.SYS_YHDL_ACTION.equals(uri)&&!Constant.SYS_SELCON_ACTION.equals(uri)
				&&!Constant.SYS_SELBMXX_ACTION.equals(uri)){
			if (userInfo == null) {
				return "login";
			}
		}
		
		return arg0.invoke();		
	}
}
